import os

traindata_num = 0.8

path = '/home/xiaoguojian/theoreticalAcademic/DG-20_32_noisy'
# path = 'F:/BaiduNetdiskDownload/data'
folders = os.listdir(path)

train = open('/home/xiaoguojian/theoreticalAcademic/rgbd_seq_train2.txt', 'a')
test = open('/home/xiaoguojian/theoreticalAcademic/rgbd_seq_test2.txt', 'a')

for label, folder in enumerate(folders):
    folders_path = path + '/' + folder
    files = os.listdir(folders_path)
    nums = len(files)
    for index, file in enumerate(files):
        if index < traindata_num*nums:
            name = folders_path + '/' + file + ' ' + str(label) + '\n'
            train.write(name)
        else:
            name = folders_path + '/' + file + ' ' + str(label) + '\n'
            test.write(name)
    print(label)
test.close()
train.close()
